package com.iltgcl.echovoicedemo.speaker

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData

interface IEchoSpeaker {
    val usage: Int
    var focusLossTransientPolicy:Int

    val speakerState: LiveData<Int>
    val rangeStart: MutableLiveData<RangeStartInfo>

    fun speak(text: CharSequence,
              utteranceId: String,
              voiceName:Int = -1,
              speed: Int = -1,
              volume:Int = -1,
              pitch:Int = -1)
    fun stop()
    fun pause(force:Boolean=true)
    fun resume()

    fun onSpeechStart(utteranceId: String)
    fun onSpeechStop(utteranceId: String)
    fun onSpeechDone(utteranceId: String)
    fun onSpeechError(utteranceId: String)
    fun onRangeStart(rangeStartInfo: RangeStartInfo)

    companion object {
        const val STATE_STOP = 0
        const val STATE_PREPARE = 1
        const val STATE_SPEAKING = 2
        const val STATE_PAUSE = 3

        const val AUDIO_FOCUS_LOSS_TRANSIENT_POLICY_NONE = 0
        const val AUDIO_FOCUS_LOSS_TRANSIENT_POLICY_PAUSE = 1
        const val AUDIO_FOCUS_LOSS_TRANSIENT_POLICY_VOLUME_DOWN = 2
    }

}